App.EditMenu = function(ds, grid) {
	var record = grid.getSelectionModel().getSelected();
	
		var modelField = new Ext.form.ComboBox({  
              		 xtype:'combo',  
					 store:new Ext.data.Store({
					 	autoLoad : true, 
						baseParams : {
							trancode : 'Menu'
						},
				        proxy: new Ext.data.HttpProxy({
				                url:'../'+WebServiceUrl
				        }),
				        // create reader that reads the project records
				        reader: new Ext.data.JsonReader({root: 'root'},[
				                {name:'name',type:'string'},
				                {name:'id',type:'string'}
				        ]),
				        listeners :{  
			                             load : function() {  
			                                 modelField.setValue(record.get('pid'));  
			                             }  
			                         }  
				     }) ,  
                     valueField:'id',  
                     displayField:'name',  
                     mode:'local',  
                     allowBlank : false,  
                     blankText : '上级菜单不能为空', 
                     forceSelection:true,   
                     emptyText:'请选择上级菜单。。。',            
                     hiddenName:'pid', 
                     editable:false,  
                     triggerAction:'all',  
                     fieldLabel:'上级菜单',
                     selectOnFocus:true,
                     //value:record.get("pid"),
                     anchor:'90%'        
         }); 
         
		var formPanel = new Ext.FormPanel({
		labelAlign : 'right',
		labelWidth : 80,
		frame : true,
		url :'../'+WebServiceUrl,
		bodyStyle : 'padding:5px 5px 0',
		width : 700,
		items : [{
			layout : 'column',
			items : [{
				columnWidth : .5,
				layout : 'form',
				items : [modelField]
			}, {
				columnWidth : .5,
				layout : 'form',
				items : [{
					xtype : 'textfield',
					fieldLabel : '菜单名称',
					tabIndex : 1,
					maxLength : 16,
					minLength : 1,
					allowBlank : false,
					name : 'name',
					id:'name',
					value :record.get("name"),
					anchor : '90%'
				}]
			}]
		}, {
			fieldLabel : '菜单连接',
			xtype : 'textfield',
			maxLength : 50,
			tabIndex : 2,
			allowBlank : false,
			name : 'url',
			id : 'url',
			value :record.get("url"),
			anchor : '95%'
		}]
	});
	var winid = 'editMenu';
	var win = new Ext.Window({
		title : '修改菜单',
		width : 720,
		height : 150,
		id : winid,
		layout : 'fit',
		plain : true,
		bodyStyle : 'padding:5px;',
		buttonAlign : 'center',
		resizable : false,
		items : formPanel,
		modal : true,
		buttons : [{
			text : '保存',
			tabIndex : 24,
			handler : function() {
				if (formPanel.form.isValid()) {
					formPanel.form.submit({
						waitTitle : "请稍候",
						waitMsg : '正在保存数据...',
						params : {
							trancode : '1003',
							id : record.get("id")
						},
						method : 'Post',
						failure : function(form, action) {
							Ext.MessageBox.alert('操作失败', action.result.message);
						},
						success : function(form, action) {
							if (action.result.success) {
								Ext.MessageBox.alert('操作成功',
										action.result.message);
								ds.load({params:{start:0, limit:App.pageSize}});
								Ext.getCmp(winid).close();
							} else {
								Ext.MessageBox.alert('操作失败',
										action.result.message);
							}
						}
					});
				} else {
					Ext.MessageBox.alert('输入错误', '请输完内容后再保存！');
				}
			}
		}, {
			text : '取消',
			tabIndex : 25,
			handler : function() {
				Ext.getCmp(winid).close();
			}
		}]
	});

	win.show();
};